package com.alibaba.citrus.cr.mn.order.center.forecastorder.convert;

import com.epoch.app.mnordercenter.model.dto.ForecastOrderLineBizQueryRequest;
import com.epoch.app.mnordercenter.model.dto.ForecastOrderLineRepoQueryReq;
import com.google.common.collect.Lists;
import org.apache.commons.lang.StringUtils;

import java.util.List;

/**
 * @author zhoubc
 * @date 2023/6/1 14:39
 */
public class ForecastOrderLineBizQueryRequestToFOLineRepoQueryReqConvertor {

    public static ForecastOrderLineRepoQueryReq convert(ForecastOrderLineBizQueryRequest forecastOrderLineBizQueryRequest) {
        ForecastOrderLineRepoQueryReq forecastOrderLineRepoQueryReq = new ForecastOrderLineRepoQueryReq();
        forecastOrderLineRepoQueryReq.setId(forecastOrderLineBizQueryRequest.getId());
        forecastOrderLineRepoQueryReq.setFrontOrderId(forecastOrderLineBizQueryRequest.getFrontOrderId());
        forecastOrderLineRepoQueryReq.setFrontOrderBizId(forecastOrderLineBizQueryRequest.getFrontOrderBizId());
        forecastOrderLineRepoQueryReq.setOuterOrderId(forecastOrderLineBizQueryRequest.getOuterOrderId());
        forecastOrderLineRepoQueryReq.setForecastOrderTypeList(forecastOrderLineBizQueryRequest.getForecastOrderTypeList());
        forecastOrderLineRepoQueryReq.setSubStatusList(forecastOrderLineBizQueryRequest.getSubStatusList());
        forecastOrderLineRepoQueryReq.setCustomerCode(forecastOrderLineBizQueryRequest.getCustomerCode());
        forecastOrderLineRepoQueryReq.setReceiveAddressCode(forecastOrderLineBizQueryRequest.getReceiveAddressCode());
        forecastOrderLineRepoQueryReq.setScItemCodeLike(forecastOrderLineBizQueryRequest.getScItemCodeLike());
        forecastOrderLineRepoQueryReq.setScItemTitleLike(forecastOrderLineBizQueryRequest.getScItemTitleLike());
        forecastOrderLineRepoQueryReq.setCustomerReferenceNo(forecastOrderLineBizQueryRequest.getCustomerReferenceNo());
        forecastOrderLineRepoQueryReq.setBizChannelList(forecastOrderLineBizQueryRequest.getBizChannelList());
        forecastOrderLineRepoQueryReq.setSalesOrganizations(forecastOrderLineBizQueryRequest.getSalesOrganizations());
        forecastOrderLineRepoQueryReq.setSaleChannels(forecastOrderLineBizQueryRequest.getSaleChannels());
        forecastOrderLineRepoQueryReq.setSalesDepartments(forecastOrderLineBizQueryRequest.getSalesDepartments());
        if(StringUtils.isNotBlank(forecastOrderLineBizQueryRequest.getCustomerExpectDate())){
            List<String> customerExpectDateList = Lists.newArrayList(forecastOrderLineBizQueryRequest.getCustomerExpectDate()+" 00:00:00",forecastOrderLineBizQueryRequest.getCustomerExpectDate()+" 23:59:59");
            forecastOrderLineRepoQueryReq.setCustomerExpectDateList(customerExpectDateList);
        }
        forecastOrderLineRepoQueryReq.setProductGroupCodeList(forecastOrderLineBizQueryRequest.getProductGroupCodeList());
        forecastOrderLineRepoQueryReq.setCreateReasonList(forecastOrderLineBizQueryRequest.getCreateReasonList());
        forecastOrderLineRepoQueryReq.setRejectReasonList(forecastOrderLineBizQueryRequest.getRejectReasonList());
        forecastOrderLineRepoQueryReq.setCustomerPurchaseDateList(forecastOrderLineBizQueryRequest.getCustomerPurchaseDateList());
        forecastOrderLineRepoQueryReq.setShippingWarehouseList(forecastOrderLineBizQueryRequest.getShippingWarehouseList());
        forecastOrderLineRepoQueryReq.setDeliveryMethod(forecastOrderLineBizQueryRequest.getDeliveryMethod());
        forecastOrderLineRepoQueryReq.setGmtCreateList(forecastOrderLineBizQueryRequest.getGmtCreateList());
        forecastOrderLineRepoQueryReq.setCreatorId(forecastOrderLineBizQueryRequest.getCreatorId());
        forecastOrderLineRepoQueryReq.setCreatorIdList(forecastOrderLineBizQueryRequest.getCreatorIdList());
        forecastOrderLineRepoQueryReq.setCreator(forecastOrderLineBizQueryRequest.getCreator());
        forecastOrderLineRepoQueryReq.setGmtUpdateList(forecastOrderLineBizQueryRequest.getGmtUpdateList());
        forecastOrderLineRepoQueryReq.setUpdatorId(forecastOrderLineBizQueryRequest.getUpdatorId());
        forecastOrderLineRepoQueryReq.setUpdator(forecastOrderLineBizQueryRequest.getUpdator());
        forecastOrderLineRepoQueryReq.setBisUnitOutCodes(forecastOrderLineBizQueryRequest.getBisUnitOutCodes());
        forecastOrderLineRepoQueryReq.setSalesOrganizationOutCodes(forecastOrderLineBizQueryRequest.getSalesOrganizationOutCodes());
        forecastOrderLineRepoQueryReq.setSalesChannelOutCodes(forecastOrderLineBizQueryRequest.getSalesChannelOutCodes());
        forecastOrderLineRepoQueryReq.setSalesDepartmentOutCodes(forecastOrderLineBizQueryRequest.getSalesDepartmentOutCodes());
        forecastOrderLineRepoQueryReq.setBusinessType(forecastOrderLineBizQueryRequest.getBusinessType());
        forecastOrderLineRepoQueryReq.setBusinessTypes(forecastOrderLineBizQueryRequest.getBusinessTypes());
        forecastOrderLineRepoQueryReq.setStart(forecastOrderLineBizQueryRequest.getStart());
        forecastOrderLineRepoQueryReq.setLimit(forecastOrderLineBizQueryRequest.getLimit());
        forecastOrderLineRepoQueryReq.setDir(forecastOrderLineBizQueryRequest.getDir());
        forecastOrderLineRepoQueryReq.setAsc(forecastOrderLineBizQueryRequest.getAsc());
        forecastOrderLineRepoQueryReq.setFields(forecastOrderLineBizQueryRequest.getFields());
        forecastOrderLineRepoQueryReq.setSize(forecastOrderLineBizQueryRequest.getSize());
        forecastOrderLineRepoQueryReq.setPage(forecastOrderLineBizQueryRequest.getPage());
        return forecastOrderLineRepoQueryReq;
    }
}
